﻿$(document).ready(function(){
    submitInfo();
    $("#btnFromClose").unbind("click").bind("click", closePopframe);
});
    function submitInfo() { 
        var $postState=$("#hidHttpPostState");
        if ($postState != null && $postState != undefined && $postState.val() == 9) {
             $.ligerDialog.success('操作成功！');
             $postState.val("");
             closePopframe();
        }
     }
     //关闭弹出的子页面
     function closePopframe() {
         // var $grid = $("div class=['divPopupChildHasRefresh-parent']");
         var $gird = $("#hidHttpRefeParent");
         if ($gird != null && $gird != undefined) {
             if ($gird.val() == "grid") {
                 window.parent.initligerGrid();
             }
             else if ($gird.val() == "tree") {
                 window.parent.InitTreeData();
             }
         }
         window.parent.$.ligerDialog.close();
         window.parent.$(".l-dialog,.l-window-mask").css({ "display": "none" });
     }
     //这个是针对AJAX提交成功后自动关闭
     function ajaxSubmitSuccess() {
         closePopframe();
     }



     //获得FORM的GRID高度
     function initFormGridHeight(formDiv,detailGrid) {
//         var wh = $(window).height();
//         var fh = $("#" + formDiv).height();
//         $("#" + detailGrid).height(wh - fh - 50);
//         alert(wh - fh - 50);
     }

     //判断明细是否符合条件
     function validateGridDetail(manager, filed) {
         if (manager != null && manager != undefined) {
             var allRows = manager.rows;
             var allLen = allRows.length;
             for (var k = 0; k < allLen; k++) {
                 if (allRows[k][filed] <= 0) {
                     return false;
                     break;
                 }
             }
             return true;
         }
         return false;
     }
     //判断明细是否符合条件
     function validateGridDetailHasZero(manager, filed) {
         if (manager != null && manager != undefined) {
             var allRows = manager.rows;
             var allLen = allRows.length;
             for (var k = 0; k < allLen; k++) {
                 if (allRows[k][filed] < 0) {
                     return false;
                     break;
                 }
             }
             return true;
         }
         return false;
     }